#Made on request of a friend.

module Com;module Googlecode;module VikrantIncubator

  $_count = 0
  $_size = 0

  def remove_thumbs_db
    puts "Enter the path of the directory."
    s = gets.strip
    recurse_for_directories s
    puts "Deleted total #{$_count} Thumbs.db of size #{sprintf("%.2f", $_size.to_f / 1024 / 1024) } MB"
  end

  def recurse_for_directories dir
    Dir[dir + '/*'].each { |d|
      if File.directory? d
        puts "Entering #{d}"
        th = d + '/Thumbs.db'
        if File.exists? th
          $_count += 1
          $_size += File.size th
          File.delete th
          puts "Deleted #{th}"
        end
        recurse_for_directories(d)
      end
    }
  end

end;end;end
